import { reqCategoryList } from "@/api"

// home的小仓库

const actions = {
    // 通过api里的接口函数调用，向服务器调用数据
    async categoryList({commit}) {
        let result = await reqCategoryList();
        if (result.code == 200) {
            commit('CATEGORYLIST', result.data)
        }
    }
}
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList
    }
}
const state = {
    //state中的数据默认初始值要和服务器一样
    categoryList: []
}
const getters = {}
export default {
    actions,
    mutations,
    state,
    getters
}